package com.design.designmode.struct.combine;

import java.util.ArrayList;
import java.util.List;

/**
 * @author hxl
 * @since 2023-04-16
 */
public class Composite extends Component {

    private List<Component> child = new ArrayList<>();

    public Composite(String name) {
        this.name = name;
    }

    @Override
    public boolean add(Component component) {
        return child.add(component);
    }

    @Override
    public boolean remove(Component component) {
        return child.remove(component);
    }

    @Override
    public List<Component> getChildren() {
        return child;
    }
}
